{ "org.gnome.desktop.interface", "cursor-theme", "gtk-cursor-theme-name", G_TYPE_STRING, { .s = "Adwaita" } },
{ "org.gnome.desktop.interface", "cursor-size", "gtk-cursor-theme-size", G_TYPE_INT, { .i = 32 } },
{ "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
+ { "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN, { .b = TRUE } },
+ { "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
+ { "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 3600 } },
{ "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 250 } },
"Net/DoubleClickTime\0" "gtk-double-click-time\0"
"Net/DoubleClickDistance\0" "gtk-double-click-distance\0"
"Net/DndDragThreshold\0" "gtk-dnd-drag-threshold\0"
+ "Net/CursorBlink\0" "gtk-cursor-blink\0"
+ "Net/CursorBlinkTime\0" "gtk-cursor-blink-time\0"
"Net/ThemeName\0" "gtk-theme-name\0"
"Net/IconThemeName\0" "gtk-icon-theme-name\0"
"Gtk/ColorPalette\0" "gtk-color-palette\0"
"Gtk/FontName\0" "gtk-font-name\0"
"Gtk/KeyThemeName\0" "gtk-key-theme-name\0"
"Gtk/Modules\0" "gtk-modules\0"
+ "Gtk/CursorBlinkTimeout\0" "gtk-cursor-blink-timeout\0"
"Gtk/CursorThemeName\0" "gtk-cursor-theme-name\0"
"Gtk/CursorThemeSize\0" "gtk-cursor-theme-size\0"
"Gtk/ColorScheme\0" "gtk-color-scheme\0"
{"Net/DoubleClickTime", "gtk-double-click-time"},
{"Net/DoubleClickDistance", "gtk-double-click-distance"},
{"Net/DndDragThreshold", "gtk-dnd-drag-threshold"},
+ {"Net/CursorBlink", "gtk-cursor-blink"},
+ {"Net/CursorBlinkTime", "gtk-cursor-blink-time"},
{"Net/ThemeName", "gtk-theme-name"},
{"Net/IconThemeName", "gtk-icon-theme-name"},
{"Gtk/ColorPalette", "gtk-color-palette"},
{"Net/SoundThemeName", "gtk-sound-theme-name"},
{"Net/EnableInputFeedbackSounds", "gtk-enable-input-feedback-sounds"},
{"Net/EnableEventSounds", "gtk-enable-event-sounds"},
+ {"Gtk/CursorBlinkTimeout", "gtk-cursor-blink-timeout"},
{"Gtk/ShellShowsAppMenu", "gtk-shell-shows-app-menu"},
{"Gtk/ShellShowsMenubar", "gtk-shell-shows-menubar"},
{"Gtk/EnablePrimaryPaste", "gtk-enable-primary-paste"},
#define MAX_ICONS 2
-#define CURSOR_BLINK_TIME 1200
-#define CURSOR_BLINK_TIMEOUT_SEC 10
-
#define IS_VALID_ICON_POSITION(pos) \
((pos) == GTK_ENTRY_ICON_PRIMARY || \
(pos) == GTK_ENTRY_ICON_SECONDARY)
if (gtk_widget_has_focus (GTK_WIDGET (entry)) &&
priv->editable &&
priv->selection_bound == priv->current_pos)
- return TRUE;
+ {
+ GtkSettings *settings;
+ gboolean blink;
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (entry));
+ g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+
+ return blink;
+ }
else
return FALSE;
}
return paste;
}
+static gint
+get_cursor_time (GtkEntry *entry)
+{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
+ gint time;
+
+ g_object_get (settings, "gtk-cursor-blink-time", &time, NULL);
+
+ return time;
+}
+
+static gint
+get_cursor_blink_timeout (GtkEntry *entry)
+{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
+ gint timeout;
+
+ g_object_get (settings, "gtk-cursor-blink-timeout", &timeout, NULL);
+
+ return timeout;
+}
+
static void
show_cursor (GtkEntry *entry)
{
{
GtkEntry *entry;
GtkEntryPrivate *priv;
+ gint blink_timeout;
entry = GTK_ENTRY (data);
priv = entry->priv;
g_assert (priv->selection_bound == priv->current_pos);
- if (priv->blink_time > 1000 * CURSOR_BLINK_TIMEOUT_SEC &&
- CURSOR_BLINK_TIMEOUT_SEC < G_MAXINT/1000)
+ blink_timeout = get_cursor_blink_timeout (entry);
+ if (priv->blink_time > 1000 * blink_timeout &&
+ blink_timeout < G_MAXINT/1000)
{
/* we've blinked enough without the user doing anything, stop blinking */
show_cursor (entry);
else if (priv->cursor_visible)
{
hide_cursor (entry);
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
else
{
show_cursor (entry);
- priv->blink_time += CURSOR_BLINK_TIME;
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_time += get_cursor_time (entry);
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
if (!priv->blink_timeout)
{
show_cursor (entry);
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
if (priv->blink_timeout != 0)
g_source_remove (priv->blink_timeout);
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
show_cursor (entry);
*
* Whether the cursor should blink.
*
- * Deprecated: 3.10: This setting is ignored.
+ * Also see the #GtkSettings:gtk-cursor-blink-timeout setting,
+ * which allows more flexible control over cursor blinking.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-cursor-blink",
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
NULL);
g_assert (result == PROP_CURSOR_BLINK);
-
- /**
- * GtkSettings:gtk-cursor-blink-time:
- *
- * Length of the cursor blink cycle, in milliseconds.
- *
- * Deprecated: 3.10: This setting is ignored.
- */
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-cursor-blink-time",
P_("Cursor Blink Time"),
* #GtkSettings:gtk-cursor-blink to %FALSE.
*
* Since: 2.12
- *
- * Deprecated: 3.10: This setting is ignored.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-cursor-blink-timeout",
#define SPACE_FOR_CURSOR 1
-#define CURSOR_BLINK_TIME 1200
-#define CURSOR_BLINK_TIMEOUT_SEC 10
+#define GTK_TEXT_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TEXT_VIEW, GtkTextViewPrivate))
typedef struct _GtkTextWindow GtkTextWindow;
typedef struct _GtkTextPendingScroll GtkTextPendingScroll;
static gboolean
cursor_blinks (GtkTextView *text_view)
{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
+ gboolean blink;
+
#ifdef DEBUG_VALIDATION_AND_SCROLLING
return FALSE;
#endif
if (gtk_get_debug_flags () & GTK_DEBUG_UPDATES)
return FALSE;
+ g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+
+ if (!blink)
+ return FALSE;
+
if (text_view->priv->editable)
{
GtkTextMark *insert;
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
if (gtk_text_iter_editable (&iter, text_view->priv->editable))
- return TRUE;
+ return blink;
}
return FALSE;
return paste;
}
+static gint
+get_cursor_time (GtkTextView *text_view)
+{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
+ gint time;
+
+ g_object_get (settings, "gtk-cursor-blink-time", &time, NULL);
+
+ return time;
+}
+
+static gint
+get_cursor_blink_timeout (GtkTextView *text_view)
+{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
+ gint time;
+
+ g_object_get (settings, "gtk-cursor-blink-timeout", &time, NULL);
+
+ return time;
+}
+
+
/*
* Blink!
*/
GtkTextView *text_view;
GtkTextViewPrivate *priv;
gboolean visible;
+ gint blink_timeout;
text_view = GTK_TEXT_VIEW (data);
priv = text_view->priv;
visible = gtk_text_layout_get_cursor_visible (priv->layout);
- if (priv->blink_time > 1000 * CURSOR_BLINK_TIMEOUT_SEC &&
- CURSOR_BLINK_TIMEOUT_SEC < G_MAXINT/1000)
+ blink_timeout = get_cursor_blink_timeout (text_view);
+ if (priv->blink_time > 1000 * blink_timeout &&
+ blink_timeout < G_MAXINT/1000)
{
/* we've blinked enough without the user doing anything, stop blinking */
visible = 0;
priv->blink_timeout = 0;
}
else if (visible)
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
else
{
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
- priv->blink_time += CURSOR_BLINK_TIME;
+ priv->blink_time += get_cursor_time (text_view);
}
/* Block changed_handler while changing the layout's cursor visibility
{
gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
- priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}